using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

public class ButtonUI : MonoBehaviour
{
    //public Button main, second, b1, b2, b3, b4;
    public Button[] buttons;
    public TextMeshProUGUI b1T;

    //public Sprite main;
    //public Sprite second;
    public Sprite b_;

    public Person p;

    public void Awake()
    {
        NullWarning.Check(buttons);
        NullWarning.Check(b1T);
        //NullWarning.Check(main);
        //NullWarning.Check(second);
        NullWarning.Check(b_);
    }

    public void Do(Person p)
    {
        foreach (Button b in buttons)
            b.image.sprite = b_;
        this.p = p;
        for (int i = 0; i < p.buttonSprites.Length; i++)
        {
            Sprite sp = p.buttonSprites[i];
            buttons[i].image.sprite = sp;
        }
    }

    private void Update()
    {
        if (p != null)
            b1T.text = p.skillText;
    }
}
